﻿using System.Threading.Tasks;
using MenusHunter.WinRT.Core.Services.Account;

namespace MenusHunter.WinRT.Core.Models
{
    public class AccountsManager
    {
        public static async Task<Account> GetAccountByEmailAsync(string email)
        {
            var client = new AccountsManagerSoapClient();
            var response = await  client.GetAccountByEmailAsync(email);

            return response.Body.GetAccountByEmailResult; 
        }

        public static async Task<Account> CheckLoginAsync(string email, string password)
        {
            
            var client = new AccountsManagerSoapClient();
            var response = await client.CheckLoginAsync(email,password);
            return response.Body.CheckLoginResult;
        }

        public static async Task<int> NewAccount(Account account)
        {
            var client = new AccountsManagerSoapClient();

            var respone =
                await
                client.NewAccountAsync(account.Email, account.Password, account.FullName, account.Avatar, account.Gender,
                                       account.Address, account.Phone, account.Birthday, account.AccessToken,
                                       account.Type, account.Status);

            return respone.Body.NewAccountResult;
        }

    }
}